package com.example.interview.example.bankCallSystem.impl_3;

public class Consumer {//客户
    public Integer id;
    public String type;

    public Consumer(Integer id, String type) {
        this.id = id;
        this.type = type;
    }
    //顾客去柜台办理业务的时候,所花的时间和柜台没有关系,只和自己的业务相关#因此,execute里面会根据consumer的type来决定线程sleep多长时间
    public void execute() {
        try {
            if (type.equals("normal")) {
                Thread.sleep(1000);
                return;
            }
            if (type.equals("quick")) {
                Thread.sleep(300);
                return;
            }
            if (type.equals("vip")) {
                Thread.sleep(1000);
                return;
            }
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }

}
